
import request from '@/router/axios'

export function fetchTree(query) {
  return request({
    url: '/admin/region/tree',
    method: 'get',
    params: query
  })
}

export function fetchList(query) {
  return request({
    url: '/admin/region/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/admin/region',
    method: 'post',
    data: obj
  })
}

export function getByCode(id) {
  return request({
    url: '/admin/region/regionCode/' + id,
    method: 'get'
  })
}

export function getByRegionName(regionName) {
  return request({
    url: '/admin/region/regionName/' + regionName,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/admin/region/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/admin/region',
    method: 'put',
    data: obj
  })
}


export function getListByParentId(parentId) {
  return request({
      url:'/admin/region/parentId/'+parentId,
      method: 'get'
  })
}


